package onetotwenty;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import java.io.File;
import java.io.FileNotFoundException;
import java.math.BigInteger;
import java.util.Scanner;

import org.junit.Test;

public class ProjectThirteen {
	@Test
	public void testRead() throws FileNotFoundException {
		Scanner scanner = new Scanner(new File("./input/13"));

		int n = 0;
		while (scanner.hasNextLine()) {
			scanner.nextLine();
			n++;
		}

		assertThat(n, is(100));
	}

	@Test
	public void testFirst() throws FileNotFoundException {
		BigInteger item = BigInteger.ZERO;
		Scanner scanner = new Scanner(new File("./input/13"));
		while (scanner.hasNextLine()) {
			item = item.add(new BigInteger(scanner.nextLine().trim()));
		}

		assertThat(item.toString().substring(0, 10), is("5537376230"));
	}
}
